/*
moxl - Modular XML Library
Copyright (c) 2007, Malcolm Sparks

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
*/
package moxl.xpath.parser.tokenizer;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import moxl.tokenizer.Token;
import moxl.xpath.tokenizer.XPathTokenTypes;

import org.junit.Before;
import org.junit.Test;

public class UnabbreviatedSyntaxTest3 extends SyntaxTestBase
{
	Token firstToken, secondToken, thirdToken;

	@Override
    @Before
	public void setUp() throws Exception
	{
		super.setUp();
		firstToken = toker.nextToken();
		secondToken = toker.nextToken();
		thirdToken = toker.nextToken();
	}

	@Override
    protected String getExpression()
	{
		return "child::text()";
	}

	@Test
	public void firstTokenType() throws Exception
	{
		assertEquals(XPathTokenTypes.AXIS_NAME, firstToken.getType());
	}

	@Test
	public void firstTokenImage() throws Exception
	{
		assertEquals("child", firstToken.getImage());
	}

	@Test
	public void secondTokenType() throws Exception
	{
		assertEquals(XPathTokenTypes.DOUBLE_COLON, secondToken.getType());
	}

	@Test
	public void secondTokenImage() throws Exception
	{
		assertEquals("::", secondToken.getImage());
	}

	@Test
	public void thirdTokenType() throws Exception
	{
		assertEquals(XPathTokenTypes.NODE_TYPE, thirdToken.getType());
	}

	@Test
	public void thirdTokenImage() throws Exception
	{
		assertEquals("text", thirdToken.getImage());
	}

	@Test
	public void remainingTokens() throws Exception
	{
		assertEquals(XPathTokenTypes.OPEN_PARENTHESIS, toker.nextToken().getType());
		assertEquals(XPathTokenTypes.CLOSE_PARENTHESIS, toker.nextToken().getType());
		assertNull(toker.nextToken());
	}

}
